package org.wishwork.api.product;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wishwork.api.product.category.CategoryQueryApi;
import org.wishwork.api.product.category.CategoryQueryRequest;
import org.wishwork.api.product.category.CategoryQueryResponse;
import org.wishwork.api.product.combine.CombineProductApi;
import org.wishwork.api.product.common.CommonProductApi;
import org.wishwork.api.product.shop.ShopProductApi;
import org.wishwork.context.Context;

import java.util.List;

/**
 * @description:商品API
 * @author: WangYX
 * @create: 2022-04-08 17:07
 * @Version: 1.0.0
 **/
public class ProductApi {

    private static final Logger log = LoggerFactory.getLogger(ProductApi.class);

    private Context context;

    private final CategoryQueryApi categoryQueryApi;

    private final CommonProductApi commonProductApi;

    private final ShopProductApi shopProductApi;

    private final CombineProductApi combineProductApi;

    public ProductApi(Context context) {
        this.context = context;
        this.categoryQueryApi = new CategoryQueryApi(context);
        this.commonProductApi = new CommonProductApi(context);
        this.shopProductApi = new ShopProductApi(context);
        this.combineProductApi = new CombineProductApi(context);
    }

    /**
     * 商品类目查询
     *
     * @return
     */
    public List<CategoryQueryResponse> category(CategoryQueryRequest categoryQueryRequest) throws Exception {
        return this.categoryQueryApi.business(categoryQueryRequest);
    }

    /**
     * 普通商品资料
     *
     * @return
     */
    public CommonProductApi common() {
        return this.commonProductApi;
    }

    /**
     * 店铺商品资料
     *
     * @return
     */
    public ShopProductApi shop() {
        return this.shopProductApi;
    }

    /**
     * 组合装商品
     *
     * @return
     */
    public CombineProductApi combine() {
        return this.combineProductApi;
    }


}
